<!DOCTYPE html>

<html>
<head>
  <title>List</title>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
  <link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
  <div id="container">
    <div id="background"></div>
    
      <ul id="jump_to">
        <li>
          <a class="large" href="javascript:void(0);">Jump To &hellip;</a>
          <a class="small" href="javascript:void(0);">+</a>
          <div id="jump_wrapper">
          <div id="jump_page">
            
              
              <a class="source" href="List.coffee.html">
                List.coffee.md
              </a>
            
              
              <a class="source" href="Map.coffee.html">
                Map.coffee.md
              </a>
            
              
              <a class="source" href="Record.coffee.html">
                Record.coffee.md
              </a>
            
              
              <a class="source" href="Set.coffee.html">
                Set.coffee.md
              </a>
            
              
              <a class="source" href="Stream.coffee.html">
                Stream.coffee.md
              </a>
            
              
              <a class="source" href="Tuple.coffee.html">
                Tuple.coffee.md
              </a>
            
              
              <a class="source" href="header.coffee.html">
                header.coffee.md
              </a>
            
          </div>
        </li>
      </ul>
    
    <ul class="sections">
        
        
        
        <li id="section-1">
            <div class="annotation">
              
              <div class="pilwrap ">
                <a class="pilcrow" href="#section-1">&#182;</a>
              </div>
              <h1 id="list">List</h1>

            </div>
            
            <div class="content"><div class='highlight'><pre>	<span class="hljs-built_in">window</span>.List = <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">List</span></span>

		<span class="hljs-attribute">constructor</span>: <span class="hljs-function"><span class="hljs-params">( elements=[] )</span> -&gt;</span>
			<span class="hljs-keyword">if</span> <span class="hljs-keyword">typeof</span> elements == <span class="hljs-string">'string'</span> <span class="hljs-keyword">or</span> arguments.length &gt; <span class="hljs-number">1</span> <span class="hljs-keyword">or</span> <span class="hljs-keyword">not</span> elements.length? <span class="hljs-keyword">then</span> elements = <span class="hljs-attribute">Array</span>::slice.call arguments
			<span class="hljs-property">@add</span> element <span class="hljs-keyword">for</span> element <span class="hljs-keyword">in</span> elements

		<span class="hljs-attribute">add</span>: Function.Chaining <span class="hljs-function"><span class="hljs-params">(element)</span> -&gt;</span>
			<span class="hljs-attribute">Array</span>::push.call <span class="hljs-keyword">this</span>, element

		<span class="hljs-attribute">member</span>: <span class="hljs-function"><span class="hljs-params">(element)</span> -&gt;</span>
			-<span class="hljs-number">1</span> != <span class="hljs-attribute">Array</span>::indexOf.call <span class="hljs-keyword">this</span>, element
	
		<span class="hljs-attribute">where</span>: Function.From<span class="hljs-function"><span class="hljs-params">(Function)</span> <span class="hljs-params">(predicate)</span> -&gt;</span>
			<span class="hljs-keyword">new</span> <span class="hljs-property">@constructor</span> ( element <span class="hljs-keyword">for</span> element <span class="hljs-keyword">in</span> <span class="hljs-keyword">this</span> <span class="hljs-keyword">when</span> predicate.call element, element )
		
		<span class="hljs-attribute">each</span>: Function.Chaining.From<span class="hljs-function"><span class="hljs-params">(Function)</span> <span class="hljs-params">(fn)</span> -&gt;</span>
			fn.call element, element <span class="hljs-keyword">for</span> element <span class="hljs-keyword">in</span> <span class="hljs-keyword">this</span>
			
		<span class="hljs-attribute">map</span>: Function.From<span class="hljs-function"><span class="hljs-params">(Function)</span> <span class="hljs-params">(fn)</span> -&gt;</span>
			<span class="hljs-keyword">new</span> List ( fn.call element, element <span class="hljs-keyword">for</span> element <span class="hljs-keyword">in</span> <span class="hljs-keyword">this</span> )

		<span class="hljs-attribute">mapAll</span>: Function.From<span class="hljs-function"><span class="hljs-params">(Function)</span> <span class="hljs-params">(fn)</span> -&gt;</span>
			<span class="hljs-keyword">new</span> <span class="hljs-property">@constructor</span> Array.flatten ( <span class="hljs-attribute">Array</span>::slice.call(fn.call element, element) <span class="hljs-keyword">for</span> element <span class="hljs-keyword">in</span> <span class="hljs-keyword">this</span> )

		<span class="hljs-property">@concat</span>: <span class="hljs-function"><span class="hljs-params">(lists...)</span> -&gt;</span>
			<span class="hljs-keyword">new</span> <span class="hljs-keyword">this</span> Array.concat lists...
				
		<span class="hljs-property">@Of</span>: Function.Cache.From<span class="hljs-function"><span class="hljs-params">(Function)</span>.<span class="hljs-title">To</span><span class="hljs-params">(Function)</span> <span class="hljs-params">(constructor)</span> -&gt;</span>
			<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">this</span></span>
				<span class="hljs-attribute">add</span>: Function.Of(constructor) <span class="hljs-attribute">this</span>::add</pre></div></div>
            
        </li>
        
    </ul>
  </div>
</body>
</html>
